package org.liujing.jsw.client.border;

import org.liujing.jsw.client.ui.*;
import org.liujing.jsw.client.dom.*;
import com.google.gwt.user.client.ui.*;
import com.google.gwt.user.client.*;
import com.google.gwt.dom.client.Style;
import com.google.gwt.core.client.GWT;
import org.liujing.jsw.client.bundle.BundledImage;

@SuppressWarnings("deprecation")
public class ImageBorderFactory{
	static BorderCornerImages corner;
	static BorderEdgeImages edge;
	
	static{
		corner = GWT.create(BorderCornerImages.class);
		edge = GWT.create(BorderEdgeImages.class);
	}
	
	public static BaseImageBorder createShadowBorder(){
		Insets ist = new Insets(8, 8, 14, 13);
		return new BaseImageBorder(new ShadowBorderImages(), ist, 40, 40);
	}
	
	public static BaseImageBorder createSmallRoundBorder(){
		Insets ist = new Insets(5, 7, 8, 5);
		return new BaseImageBorder(new SmallRoundBorderImages(), ist, 13, 12);
	}
	
	static class ShadowBorderImages implements BordImageBundle{
		public 	ShadowBorderImages(){
			
		}
		
		public BundledImage getTopLeft(){
			return corner.getShadowTopLeft();
		}
	
		public BundledImage getTop(){
			return edge.getShadowTop();
		}
		
		public BundledImage getTopRight(){
			return corner.getShadowTopRight();
		}
		
		public BundledImage getLeft(){
			return edge.getShadowLeft();
		}
		
		public BundledImage getRight(){
			return edge.getShadowRight();
		}
		
		public BundledImage getBottomLeft(){
			return corner.getShadowBottomLeft();
		}
		
		public BundledImage getBottom(){
			return edge.getShadowBottom();
		}

		public BundledImage getBottomRight(){
			return corner.getShadowBottomRight();
		}
	}
	
	static class SmallRoundBorderImages implements BordImageBundle{
		public 	SmallRoundBorderImages(){
			
		}
		
		public BundledImage getTopLeft(){
			return corner.getSRTopLeft();
		}
	
		public BundledImage getTop(){
			return edge.getSRTop();
		}
		
		public BundledImage getTopRight(){
			return corner.getSRTopRight();
		}
		
		public BundledImage getLeft(){
			return edge.getSRLeft();
		}
		
		public BundledImage getRight(){
			return edge.getSRRight();
		}
		
		public BundledImage getBottomLeft(){
			return corner.getSRBottomLeft();
		}
		
		public BundledImage getBottom(){
			return edge.getSRBottom();
		}

		public BundledImage getBottomRight(){
			return corner.getSRBottomRight();
		}
	}
}
